package com.system.controller;

import com.github.pagehelper.PageInfo;
import com.system.po.info.*;
import com.system.service.SpecialService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@Api(description = "事故处理")
@RequestMapping("eme")
@Controller
@ResponseBody
public class SpecialController {

    @Autowired
    private SpecialService specialService;


    @ApiOperation(value = "Information_place查询")
    @GetMapping("/place")
    public List<Information_place> Information_place(){
        List<Information_place> information_places = specialService.Information_place();
        return information_places;
    }

    @ApiOperation(value = "Information_scope查询")
    @GetMapping("/scope")
    public List<Information_scope> Information_scope(){

        List<Information_scope> information_scopes = specialService.Information_scope();
        return information_scopes;
    }

    @ApiOperation(value = "Information_type查询")
    @GetMapping("/type")
    public List<Information_type> Information_type(){

        List<Information_type> information_types = specialService.Information_type();
        return information_types;
    }

    @ApiOperation(value = "Information_unit查询")
    @GetMapping("/unit")
    public  List<Information_unit> Information_unit(){
        List<Information_unit> Information_units=specialService.Information_unit();
        return Information_units;
    }


    @ApiOperation(value = "报警信息")
    @PostMapping("/addmessag")
    public Boolean addmessag(@RequestBody Information_Edit information_edit){
        Boolean aBoolean=specialService.addmessag(information_edit);
        return aBoolean;
    }

    @ApiOperation(value = "全部事故通知人员")
    @GetMapping("/querypersonnel")
    public  List<Personnel>  querypersonnel(){
        List<Personnel> personnel=specialService.querypersonnel();
        return personnel;
    }


    @ApiOperation(value = "发送短信内容给所有用户")
    @GetMapping("/editsms")
    public  List<String> editsms(String content){
        List<String> editsms = specialService.editsms(content);
        return editsms;
    }


    @ApiOperation(value = "增加相关文档")
    @PostMapping("/addsfile")
    public Boolean addsfile(@RequestBody DocumentFile documentFile){
        Boolean addsfile =specialService.addsfile(documentFile);
        return addsfile;
    }

    @ApiOperation(value = "删除相关文档")
    @DeleteMapping("/addsfile")
    public Boolean deletesfile(@RequestBody DocumentFile documentFile){
        Boolean deletesfile =specialService.deletesfile(documentFile);
        return deletesfile;
    }

    @ApiOperation(value = "修改相关文档")
    @PutMapping("/editsfile")
    public Boolean editsfile(@RequestBody DocumentFile documentFile){
        Boolean editsfile =specialService.editsfile(documentFile);
        return editsfile;
    }

    @ApiOperation(value = "分页查询")
    @GetMapping("/findByPage/{page}/{limit}")
    public PageInfo<DocumentFile> findByPage(@PathVariable int  page, @PathVariable int limit){
        PageInfo<DocumentFile> byPage = specialService.findByPage(page, limit);
        return byPage;
    }

}
